<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var a = 10;
        var b = 21;

        var c = a + b;
        console.log(c);

        // 如果加法两边有一边有字符串类型的数据

        var str = "12";
        var num = 12;
        // 会将数字类型转换为字符串进行字符串拼接
        console.log(str + num) // "1212"

        console.log("10" + "20"); // 字符串拼接 "1020"
    
        // 减法的时候会（进行隐试转换）将字符串转换为数字进行计算
        console.log("12" - 12)

        console.log("10" * 2) // 20

        console.log("a10" * 2) // NaN => not a number

        console.log(typeof NaN)
    </script>
</body>
</html>